<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 深拷贝，浅拷贝 */
        /* 数组里面每一项是基本数据类型的一个深拷贝 */
        var arr = [1,2,3]
        var sum = [...arr]
        console.log(sum);
        arr.push(4)
        console.log(sum);

        var arr = [1,2,3]
        var sum = [].concat(arr)
        console.log(sum);
        arr.push(4)
        console.log(sum);

        var arr = [1,2,3]
        var sum = arr.slice(0)
        console.log(sum);
        arr.push(4)
        console.log(sum);
    </script>
</body>
</html>